﻿// -----------------------------------------------------------------------
// <copyright file="DateProducer.cs" company="">
// TODO: Update copyright text.
// </copyright>
// -----------------------------------------------------------------------

namespace Dhgms.TplHelper.Model.DatabaseScalarProducer
{
    using System;
    using System.Collections.Generic;
    using System.Data.Common;
    using System.Linq;
    using System.Text;

    /// <summary>
    /// TODO: Update summary.
    /// </summary>
    public abstract class DateProducer<TDatabaseHelper, TParameter, TParameterCollection> : DatabaseScalarProducerBase<TParameter, System.DateTime?>
        where TDatabaseHelper : Dhgms.DataManager.Model.Helper.Database.DatabaseHelperBase<TParameter, TParameterCollection>, new()
        where TParameter : DbParameter
        where TParameterCollection : DbParameterCollection
    {
        protected DateProducer(string databaseConnectionString, bool assumeSqlSafe)
            : base(databaseConnectionString, assumeSqlSafe)
        {
        }

        public override DateTime? GetResult()
        {
            return new TDatabaseHelper().GetDate(this.DatabaseConnectionString, this.SqlCommand, this.SqlParameters, this.AssumeSqlSafe);
        }
    }
}
